difficulty adj ustment, and if the difference is 20 seconds or more, then geth

reduces the difficulty adj ustment. The CalcDifficulty function adj usts the

difficulty of the system in the block_validator.go file that returns the

difficulty of the next block upon its creation.

U sing the calcDifficultyHomestead function of the latest version of

Ethereum, the steps showing how difficult it is to create a new block are as

follows:

The difference between the time of formation of the parent block and a

new block is calculated.

For the creation of ranges, divide the difference obtained by 10 and

store its integer part. The output will be 0 if the difference from step 1

is from 1 to 9 ; if it is 1 it will be between 10 and 19 , and if it is 2, it

will be between 20 and 29 .

3. Step 2 creates several ranges, and further to create three ranges, we

subtract 1 from the output of Step 2, resulting in ranges that either will

be positive, zero, or negative. The output will be positive if the output

of step 1 is between 0 and 9 , it will be zero when between 10 and 19 ,

and it will be negative when anything more than 20.

A comparison is now made between the output of the previous step

and – 9 9 or even if it is less than – 9 9 , then set it as 9 9 , done to limit the

smallest value possible of Step 3 ; otherwise, the value of the output of

the previous step is kept as it is.

The parent block difficulty is divided by 2,048, the value of the

difficulty bound divisor.

The output(s) of Step 4 and Step 5 are multiplied, giving the difference

of difficulty of a new block with the old parent block. If this difference

is positive, the difficulty will increase, and if negative, the difficulty

will decrease.

Added to parent difficulty is the output of Step 6, whose result is the

difficulty of the new block.

Once the difficulty is calculated, a check is made to make sure that the

difficulty calculated is at least more than the minimum threshold value

of 13 1,07 2.